<template>
    <div>
        <!-- 组件通信-父传子  -->
        <!-- <B :title='n'></B> -->
        <!-- 组件通信-子传父 -->
        <!-- <B @send="getMessage"></B> -->
        <span>{{n}}</span>
        <add @sendMessage="getData"></add>   
    </div>
</template>
<script>
import B from './B';
import Add from './Add.vue';
export default {
    components:{
        B,
        Add
    },
    data(){
        return{
            n:10
        }
    },
    methods:{
        getMessage(msg){       //  $emit('send','事件参数')
            console.log(msg)   // 123 
        },
        getData(){
            this.n++;
        }
    }
}
</script>
<style scoped>

</style>